#include "StdAfx.h"
#include "ImageProcStep.h"
#include "ProcParamDefInt.h"
#include "ProcParamInt.h"
#include "ImageProcFn.h"
#include "DummyOne.h"

const char * const DummyOne::FunctionNameDummyOne = "CalcAvBrightness";

DummyOne::DummyOne(void) 
{
	_fnApi.SetFunctionName(DummyOne::FunctionNameDummyOne);
	_fnApi.SetFunctionDescription("this is a dummy function with one i/p param and one o/p param");
									//inputs
	_fnApi.AddParamDef(new ProcParamDefInt(0, "brightness", "sets brightness of image in range 0 to 100", ProcParamDef::input, 0, 100 ));
									//outputs
	_fnApi.AddParamDef(new ProcParamDefInt(0, ProcParam::attribOutputParamNameResult, "process simply copies input value to output value", ProcParamDef::output, 0, 100));

	_fnApi.Validate();
}


DummyOne::~DummyOne(void)
{
}


bool		DummyOne::Process(ImageProcStep *step, bool DebugMode)
{
	bool rc = false;
	if ((step != '\0') && (step->IsValid()))
	{
		ProcParamInt *input = dynamic_cast<ProcParamInt *>(step->GetInputs()->GetParam(0));
		ProcParamInt *output = dynamic_cast<ProcParamInt *>(step->GetOutputs()->GetParam(0));
		if ((input != '\0') && (output != '\0'))
		{
			output->SetValue(input->GetValue());
			rc = true;
		}
	}
	return rc;
}




